# coding=utf-8

import unittest
from Calculator import Calculator


class TestCalculator(unittest.TestCase):

    def setUp(self):
        print("test start")
        self.cal = Calculator(4, 2)

    def test_001_add(self):
        """
        测试加法函数
        :return:
      """
        self.result = self.cal.add()
        self.assertEqual(self.result, 6, "计算错误！")

    def test_002_reduce(self):
        """
        测试减法函数
        :return:
      """
        self.result = self.cal.reduce()
        self.assertEqual(self.result, 2, "计算错误！")

    def test_003_ride(self):
        """
        测试乘法函数
        :return:
      """
        self.result = self.cal.ride()
        self.assertEqual(self.result, 8, "计算错误！")

    def test_004_division(self):
        """
        测试除法函数
        :return:
      """
        self.result = self.cal.division()
        self.assertEqual(self.result, 2, "计算错误！")

    def tearDown(self):
        print("test end")


if __name__ == '__main__':
    unittest.main(verbosity=2)
